<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>index</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" href="./css/common.css">
	</head>

	<body>
		<div id="login">
			用户名<input type="text" v-model="form.username" /><br/>
			密码<input type="password" v-model="form.password" /><br/>
			<!-- 验证码<input type="text" v-model="form.code" /> <input type="image" class="img" src="" /> -->
			<input type="button" name="提交" @click="submit" class="btn" value="提交" />
		</div>
		<script src="../../js/mui.min.js"></script>
		<script type="text/javascript" src="../../js/jquery-3.2.1.min.js"></script>
		<script type="text/javascript" src="../../js/vue.js"></script>
		<script src="./js/md5.js"></script>
		<script src="./js/mkeyplus.base.js"></script>
		<script type="text/javascript" charset="utf-8">
			mui.init();
			mui.plusReady(function() {
				// modify();
			});
			
			var vm = new Vue({
			  el: '#login',
			  data: {
				 form:{
					 "username":"admin",
					 "password":"Cgnne@123",
					 // "password":"04ac8465b256f75d45396dab68d8cfa2",
					 // "code":"",
					 // "uuid":""
				 }
			  },
			  created: function() {
			  },
			  methods: {
				  submit(){
					  // vm.form.password = md5(vm.form.passowrd);
					  console.log(JSON.stringify(vm.form));
					  // return;
					  mui.baseApp.httpRequst("/auth/login", vm.form, function(data) {
						console.log('data........',JSON.stringify(data));
						localStorage.setItem('ddmsToken', data.token);
						mui.openWindow({
							  url: 'home.html',
							  id: '../ddms/home.html',
							  extras: {}
						});
					  }, function() {
					  	plus.nativeUI.closeWaiting();
					  }, 'post')
				  }
			  }
			})

			function modify() {
				mui.baseApp.httpRequst("/auth/code", {}, function(data) {
					document.querySelector('.img').src = data.img
					vm.form.uuid = data.uuid;
				}, function() {
					plus.nativeUI.closeWaiting();
				}, 'get')
			}
		</script>
	</body>

</html>
